package gcommand

import (
	. "Ghost/utd"
	"github.com/lxn/walk"
)

var TheModelLogin *ModelLogin = &ModelLogin{ErrorTip: "", LoginText: "登 陆"}

type ModelLogin struct {
	dbind     *walk.DataBinder
	RoostHost string
	Account   string
	Password  string
	ErrorTip  string
	LoginText string
}

func (this *ModelLogin) Init() {
	this.RoostHost = TheConfig.Config.RoostHost
	this.Account = TheConfig.Config.Account
	this.Password = TheConfig.Config.Password
}
func (this *ModelLogin) SetupBinder(dbind *walk.DataBinder) { this.dbind = dbind }

func (this *ModelLogin) ResetBinder(reset bool) {
	UHelp.IFCast(this.dbind != nil && reset, func() { this.dbind.Reset() }, nil)
}
func (this *ModelLogin) SetErrorTip(s string, reset bool) {
	this.ErrorTip = s
	this.ResetBinder(reset)
}
func (this *ModelLogin) SetLoginText(s string, reset bool) {
	this.LoginText = s
	this.ResetBinder(reset)
}
